/**
 * @file		gto1200.h
 * @author		Fantei-Caujolle
 * @version   	$Rev: 105 $
 * @date       	25 Novembre 2011
 * $LastChangedDate: 2012-11-06 18:10:39 +0100 (mar., 06 nov. 2012) $
 * @brief       Control general astronomic mount
 *
 * @details     this subclass control communication with astronomic mount system\n
 *
 */
#include "serial.h"
#include "mount/mount.h"
#include "type.h"



class gto1200: public mount, public serial
{
public:
    gto1200();
    ~gto1200(void);

    int ReadConfigFile(QString path, QString key);
    int SaveConfigFile(QString path, QString key);
    void init(void);

    // setters
    int SetLocalLongitude(CoordonneeGeo Localisation);
    int SetLocalLatitude(CoordonneeGeo Latitude);
    int SetLocalAltitude(CoordonneeGeo Localisation);
    int SetGuideRate(double);
    int SetSlewRate(double);
    int SetSlewRate2(int);
    int SetSlewSpeed(int speed);
    int setCenteringRate(int speed);
    int SetTracking(int mode);
    int SetBacklashDEC(CoordonneeEqu Coord);
    int SetBacklashRA(CoordonneeEqu Coord);
    void SetHorizonCheck(bool Horizon);
    int SetRA(CoordonneeEqu Coord);
    int SetDEC(CoordonneeEqu Coord);
    int SetAzimut(CoordonneeEqu Coord);
    int SetAltitude(CoordonneeEqu Coord);
    int SetLocalDateTime(TimeStruct Time);
    int SetOffset(int offset);
    int SetAltZimutalMode(CoordonneeEqu coord);
    int SetPEMMode(int val);
    int EquatorialFork(bool val);

    // getters
    int GetRa(CoordonneeEqu *Coord);
    int GetDec(CoordonneeEqu *Coord);
    int GetLocalTime(TimeStruct *Time);
    int GetAzimuth(StructDeg *CurrentAzimuth);
    int GetAltitude(StructDeg *CurrentAltitude);
    int GetSidePier(QString *pier);
    int GetVersion(QString *version);
    int GetOffset(TimeStruct *offset);
    int GetCurrentLongitude(CoordonneeEqu *coord);
    int GetCurrentLatitude(CoordonneeEqu *coord);
    int GetCurrentSideralTime(TimeStruct *coord);

    // divers
    int Calibrate();
    int ReCalibrate();

    void Park(void);
    void UnPark(void);
    QString ConvertGuideType(int);
    int ConvertGuideType(QString);
    void SwapEW(void);
    void SwapNS(void);
    void Guiding(bool val);
    int ThreadMoveNorth(int Time_ms);
    int MoveNorth(int Time_ms);
    int MoveSouth(int Time_ms);
    int MoveEast(int Time_ms);
    int MoveWest(int Time_ms);
    int MoveNorth();
    int MoveSouth();
    int MoveEast();
    int MoveWest();
    int Stop(QString direction);
    void Stop2Axe();
    int Goto(CoordonneeEqu coord);


    // serial port operation
    int OpenPort(void);
    int ClosePort(void);
    int sendMessage(QString message);
    int readPort(QString *reponse);

public:
    bool bPortIsReady;
    bool bNoreply;

private:
    serial *Port; //!< serial port definition

};

